1. Technical Field
This disclosure relates generally to floating-point operations in computer processors.
2. Description of the Related Art
Blending operations in a graphics unit may involve determining a resulting color component for a particular pixel based two input color components. For example, linear interpolation is one form of blending and involves the operation C*X+D*(1−X) where C and D may be any value (e.g., input pixel color component values) and X is between 0 and 1.0 inclusive. For example, if X is large, C is given larger weight, while if X is small, D is given larger weight in the blending.
When X is represented in some floating-point formats, X+(1−X) may not be guaranteed to be equal to 1. For example, when X is smaller than 0.5, a floating-point representation of X may have more precision than a floating-point representation of 1-X and X+(1−X) may be less than 1 when rounding to zero. Thus, if multiple blending operations are performed, the components of a pixel may gradually shift toward zero, eventually causing the pixel to appear black. Shifts in the other direction may similarly occur for other rounding modes.